# To change this template, choose Tools | Templates
# and open the template in the editor.

class Matrice
  attr_reader :tab, :dim

  def initialize
    @tab = Array.new()
    @dim
  end

  def generate(file)
    i = 0
    c = 0
    while line = file.gets
      if /dimension/.match(line)
        @dim = file.gets.to_i
      elsif /\d\s{2,}/.match(line)
        @tab[i] = Array.new
        line.split(' ').each { |line| @tab[i].push(line.to_f) }
        i+=1
      elsif /\d/.match(line)
        @tab[c].push(line.chop.to_f)
        c+=1
      end
    end
  end
end
